//
//  SexControl.m
//  FreeTime
//
//  Created by  on 16/8/26.
//  Copyright © 2016年 SRDZ.com. All rights reserved.
//

#import "SexControl.h"
#import "SexCell.h"
@interface SexControl ()

@end

@implementation SexControl

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupNav];
    [self setupUI];
}
#pragma mark -- selfStyle --

- (void)setupUI{
    self.navigationItem.title = @"显示性别";
    [self.tableView registerClass:[SexCell class] forCellReuseIdentifier:@"SexCell"];
}
#pragma mark tableViewMethord
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellIdentifier = @"SexCell";
    SexCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.tag = 100+indexPath.row;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//    SexCell * cell = [tableView cellForRowAtIndexPath:indexPath];
    NSArray * cellArr = [tableView visibleCells];
    for (SexCell * cell in cellArr) {
        if (cell.tag-100 == indexPath.row) {
            cell.chooseImg.image = [UIImage imageNamed:@"queding"];
        }else{
            cell.chooseImg.image = [UIImage imageNamed:@"meiqueding"];
            
        }
    }
}
@end
